<!-- 业务组 -->
<template>
    <div>
        <el-table
            ref="currencyTable"
            :data="tableData"
            stripe
            border
            style="width: 100%"
            @selection-change="getSelectVal"
            @cell-dblclick="cellDblclick"
        >
            <el-table-column
                type="selection"
                width="55"
                align="center"
            ></el-table-column>
            <el-table-column
                type="index"
                label="序号"
                width="55"
                align="center"
            ></el-table-column>
            <el-table-column prop="businessGroupType" label="业务组">
                <template slot-scope="scope">
                    {{ scope.row.businessGroupType || "--" }}
                </template>
            </el-table-column>
            <el-table-column prop="describe" label="描述">
                <template slot-scope="scope">
                    {{ scope.row.describe || "--" }}
                </template>
            </el-table-column>
            <el-table-column prop="createTime" label="创建时间">
                <template slot-scope="scope">
                    {{ scope.row.createTime || "--" }}
                </template>
            </el-table-column>
            <el-table-column prop="changeTime" label="更新时间">
                <template slot-scope="scope">
                    {{ scope.row.changeTime || "--" }}
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
            class="pagination mt20"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="limit"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            background
        >
        </el-pagination>
    </div>
</template>

<script>
import { getPurchaseData } from "@/api/base/data";
export default {
    data() {
        return {
            tableData: [],
            page: 1, //当前页
            limit: 10, //每页条数
            total: 0,
        };
    },
    methods: {
        //分页器size
        handleSizeChange(val) {
            this.limit = val;
            this.getDataList();
        },
        //分页器当前页
        handleCurrentChange(val) {
            this.page = val;
            this.getDataList();
        },
        getSelectVal(val, isDbleclick) {
            this.$emit("getSelectVal", val, isDbleclick);
        },
        getDataList() {
            let params = {
                limit: this.limit,
                page: this.page,
            };
            getPurchaseData(params).then((res) => {
                this.tableData = res.data.records;
                this.total = res.data.total;
            });
        },
        cellDblclick(value) {
            let selectItem = [];
            selectItem.push(value);
            this.getSelectVal(selectItem, true);
        },
    },
    mounted() {
        this.getDataList();
    },
};
</script>

<style></style>
